package pikasial.images.tags;

import javax.swing.ImageIcon;

public abstract class Tag {
	protected String tag;
	protected String iconPath;
	protected String lowResIconPath;

	public Tag(String t) {
		this(t,null,null);
	}

	public Tag(String t, String iconPath,String lowResIconPath) {
		setDescription(t);
		this.iconPath = iconPath;
		this.lowResIconPath = lowResIconPath;
	}

	public ImageIcon getIcon() {
		if (iconPath == null) return null;
		return new ImageIcon(getClass().getResource(iconPath));
	}

	public ImageIcon getLowResIcon() {
		if (lowResIconPath == null) return null;
		return new ImageIcon(getClass().getResource(lowResIconPath));
	}

	public String getDescription() { return tag; }

	public abstract String getTagName();

	public void setDescription(String desc) {
		tag = desc;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (!(o instanceof Tag))
			return false;
		Tag t = (Tag) o;
		return (tag.equals(t.tag) && getDescription().equals(t.getDescription()));
	}

	public String toString() {
		return tag+" : "+getDescription();
	}
}
